#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int findDepth(char* str) {
    int depth = 0;
    int maxDepth = 0;

    while (*str != '\0') {
        if (*str == '(') {
            depth++;
            if (depth > maxDepth) {
                maxDepth = depth;
            }
        }
        else if (*str == ')') {
            depth--;
        }

        str++;
    }

    return maxDepth;
}

int main() {
    char str[100];
    scanf("%s", str);
    int depth = findDepth(str);
    printf("%d\n", depth);

    return 0;
}